package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class ComparatorDemo {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("李思思思思");
        list.add("张三三");
        list.add("王");

        Collections.sort(list, (o1,o2)->o1.length()-o2.length());
        System.out.println("排序后："+list);
        Comparator<String> comparator = Comparator.naturalOrder();

    }
}
